<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改取号功能')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ticketno-edit" th:object="${sjTicketno}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="ownerId" th:field="*{ownerId}" class="form-control" type="hidden" >
            <input name="deptId" th:field="*{deptId}" class="form-control" type="hidden" >
            <div class="form-group" id="orderNoDiv" style="display:none;">    
                <label class="col-sm-2 control-label is-required">编号：</label>
                <div class="col-sm-4">
                    <input name="orderNo" class="form-control" type="text" th:field="*{orderNo}" required>
                </div> 
            </div>
            <div class="form-group">   
            	<label class="col-sm-2 control-label is-required">名称：</label> 
                <div class="col-sm-4">
		            <select name="name" class="form-control" th:field="*{name}">
						<option th:each="po:${polis}" th:value="${po.name}" th:text="${po.name}"></option>
					</select>
                </div> 
                <label class="col-sm-2 control-label is-required">类型：</label>
                <div class="col-sm-4">
                    <select name="qhd" th:field="*{qhd}" class="form-control" th:with="type=${@dict.getType('sj_ticketno_qhd')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">   
                <label class="col-sm-2 control-label is-required">项目类型：</label>
                <div class="col-sm-4">
					<select name="proType" th:field="*{proType}" class="form-control" th:with="type=${@dict.getType('sj_nsct_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.remark}"></option>
                    </select>
                </div>
                <label class="col-sm-2 control-label is-required">公司类型：</label>
                <div class="col-sm-4">
                    <select name="leixing" th:field="*{leixing}" onchange="changeType()" class="form-control" th:with="type=${@dict.getType('sj_ticketno')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">申请人：</label>
                <div class="col-sm-4">
                    <input name="owner" class="form-control" th:field="*{owner}" type="text" required readonly="readonly">
                </div>
                <label class="col-sm-2 control-label is-required">申请部门：</label>
                <div class="col-sm-4">
                    <input name="dept" class="form-control" th:field="*{dept}" type="text" required readonly="readonly">
                </div>
            </div>
            <div class="form-group">    
            	<label class="col-sm-2 control-label is-required">申请日期：</label>
                <div class="col-sm-4">
                    <div class="input-group date">
                        <input name="sqAt" th:value="${#dates.format(sjTicketno.sqAt, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label is-required">描述：</label>
                <div class="col-sm-10">
                    <textarea name="descs" class="form-control" required>[[*{descs}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/ticketno";
        $("#form-ticketno-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-ticketno-edit').serialize());
            }
        }

        $("input[name='sqAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        
        function changeType(){
        	console.log($("select[name='leixing']").val());
        	//类型==建艺总公司
        	if($("select[name='leixing']").val()=='JYHB'){
        		$("#orderNoDiv").attr("style","display:block;");
        	}else{
        		$("#orderNoDiv").attr("style","display:none;");
        	}
        }
        
        $(function() {
        	changeType();
        });
    </script>
</body>
</html>